.class Llt/noframe/gpsfarmguide/views/FragmentMap$4;
.super Landroid/content/BroadcastReceiver;
.source "FragmentMap.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Llt/noframe/gpsfarmguide/views/FragmentMap;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Llt/noframe/gpsfarmguide/views/FragmentMap;


# direct methods
.method constructor <init>(Llt/noframe/gpsfarmguide/views/FragmentMap;)V
    .locals 0

    .line 750
    iput-object p1, p0, Llt/noframe/gpsfarmguide/views/FragmentMap$4;->this$0:Llt/noframe/gpsfarmguide/views/FragmentMap;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 1

    .line 754
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object p1

    const-string v0, "android.bluetooth.device.action.FOUND"

    .line 755
    invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_0

    const-string p1, "android.bluetooth.device.extra.DEVICE"

    .line 756
    invoke-virtual {p2, p1}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object p1

    check-cast p1, Landroid/bluetooth/BluetoothDevice;

    .line 759
    :try_start_0
    invoke-virtual {p1}, Landroid/bluetooth/BluetoothDevice;->getName()Ljava/lang/String;

    move-result-object p2

    iget-object v0, p0, Llt/noframe/gpsfarmguide/views/FragmentMap$4;->this$0:Llt/noframe/gpsfarmguide/views/FragmentMap;

    invoke-virtual {v0}, Landroidx/fragment/app/Fragment;->getActivity()Landroidx/fragment/app/FragmentActivity;

    move-result-object v0

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/LastPickPrefrences;->getExternalGps(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p2

    if-eqz p2, :cond_0

    .line 760
    iget-object p2, p0, Llt/noframe/gpsfarmguide/views/FragmentMap$4;->this$0:Llt/noframe/gpsfarmguide/views/FragmentMap;

    invoke-static {p2}, Llt/noframe/gpsfarmguide/views/FragmentMap;->access$600(Llt/noframe/gpsfarmguide/views/FragmentMap;)Landroid/os/Handler;

    move-result-object p2

    iget-object v0, p0, Llt/noframe/gpsfarmguide/views/FragmentMap$4;->this$0:Llt/noframe/gpsfarmguide/views/FragmentMap;

    iget-object v0, v0, Llt/noframe/gpsfarmguide/views/FragmentMap;->cancelDeviceDetection:Ljava/lang/Runnable;

    invoke-virtual {p2, v0}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
    :try_end_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_1

    .line 762
    :try_start_1
    iget-object p2, p0, Llt/noframe/gpsfarmguide/views/FragmentMap$4;->this$0:Llt/noframe/gpsfarmguide/views/FragmentMap;

    iget-object p2, p2, Llt/noframe/gpsfarmguide/views/FragmentMap;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    invoke-virtual {p2}, Landroid/bluetooth/BluetoothAdapter;->cancelDiscovery()Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    .line 764
    :catch_0
    :try_start_2
    sget-object p2, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {p2}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object p2

    invoke-virtual {p2}, Llt/farmis/libraries/externalgps/ExternalGPS;->getExternalGPSState()Llt/farmis/libraries/externalgps/providers/Status;

    move-result-object p2

    sget-object v0, Llt/farmis/libraries/externalgps/providers/Status;->INDETERMINE:Llt/farmis/libraries/externalgps/providers/Status;

    if-ne p2, v0, :cond_0

    .line 765
    sget-object p2, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {p2}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object p2

    new-instance v0, Llt/farmis/libraries/externalgps/nmea/NmeaParser;

    invoke-direct {v0}, Llt/farmis/libraries/externalgps/nmea/NmeaParser;-><init>()V

    invoke-virtual {p2, p1, v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->startBluetoothExternalGPS(Landroid/bluetooth/BluetoothDevice;Llt/farmis/libraries/externalgps/nmea/NmeaParser;)V
    :try_end_2
    .catch Ljava/lang/NullPointerException; {:try_start_2 .. :try_end_2} :catch_1

    goto :goto_0

    :catch_1
    move-exception p1

    .line 770
    invoke-virtual {p1}, Ljava/lang/NullPointerException;->printStackTrace()V

    :cond_0
    :goto_0
    return-void
.end method
